﻿@{
    ViewBag.Title = "销售管理";
}
@section headerSection{
    <style>
        #exampleToolbar > .form-group {
            float: left;
            margin: 0;
            margin-left: 5px;
        }
    </style>
}
<div class="animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins" style="margin-bottom: 0px;">
        <div class="ibox-content" style="padding: 5px 20px 0px 20px;">
            <div class="row row-lg">
                <div class="col-sm-12 col-sm-leftRight">
                    <!-- Example Toolbar -->
                    <div class="example">
                        <div class="btn-group hidden-xs" id="exampleToolbar" role="group">
                            <div class="form-group" style="margin-left:0;width:120px;">
                                <input id="sellName" name="sellName" type="text" class="form-control" placeholder="销售人">
                            </div>
                            <div class="form-group" style="width:120px;">
                                <input id="payName" name="payName" type="text" class="form-control" placeholder="购买人">
                            </div>
                            <div class="form-group" style="width:120px;">
                                <input id="orderNumber" name="orderNumber" type="text" class="form-control" placeholder="订单号">
                            </div>
                            <div class="form-group" style="width:120px;">
                                <input id="fileCode" name="fileCode" type="text" class="form-control" placeholder="商品代码">
                            </div>
                            <div class="form-group" style="margin-top:-2px;width:120px;">
                                <select id="operatorType" name="operatorType" title="操作类别" class="form-control show-tick selectpicker" placeholder="操作类别">
                                    <option value="0" selected>全部</option>
                                    <option value="1">充值</option>
                                    <option value="2">支付</option>
                                    <option value="3">分享</option>
                                </select>
                            </div>
                            <div class="form-group" style="width:140px;">
                                <input id="inDate" name="inDate" type="text" class="laydate-icon form-control input-sm" placeholder="起始操作日期" title="起始操作日期" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" />
                            </div>
                            <div class="form-group" style="width:140px;">
                                <input id="outDate" name="outDate" type="text" class="laydate-icon form-control input-sm" placeholder="截止操作日期" title="截止操作日期" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" />
                            </div>
                            <div class="form-group">
                                <button id="btnSearch" class="btn btn-primary" type="button"><i class="fa fa-search"></i>&nbsp;查询</button>
                            </div>
                        </div>
                        <table id="exampleTableToolbar" data-mobile-responsive="true" data-radio="true"></table>
                    </div>
                    <!-- End Example Toolbar -->
                </div>
            </div>
        </div>
    </div>
    <!-- End Panel Other -->
</div>
@section footSection{
    <script>
        var $table, options;
        var goldManager = {
            initPage: function () {
                goldManager.bindEvent();
                goldManager.initTable();
            },
            initTable: function () {
                options = {
                    url: ctx + "/AccountManager/GetSellData",
                    cutHeight: 5,
                    toolbar: "#exampleToolbar",
                    queryParams: function (params) {
                        params = {
                            //页面大小  
                            rows: params.limit,
                            //第几页
                            page: params.offset / params.limit + 1,
                            sellName: $('#sellName').val(),
                            payName: $('#payName').val(),
                            orderNumber: $('#orderNumber').val(),
                            fileCode: $('#fileCode').val(),
                            operatorType: $('#operatorType').val(),
                            inDate: $('#inDate').val(),
                            outDate: $('#outDate').val()
                        }
                        return params;
                    },
                    columns: [
                         {
                             radio: true
                         }, {
                             field: '',//第一列序号
                             title: '序号',
                             align: 'center',
                             width: 50,
                             formatter: function (value, row, index) {
                                 return index + 1;
                             }
                         }, {
                             field: 'create_name',
                             title: '销售人',
                             align: 'center'
                         }, {
                             field: 'gold_num',
                             title: '销售额',
                             align: 'center'
                         }, {
                             field: 'operator_type',
                             title: '类别',
                             align: 'center',
                             formatter: function (value, row, index) {
                                 switch (value) {
                                     case 1: return "<span class='label label-primary'>充值</span>"; break; 
                                     case 2: return "<span class='label label-danger'>支付</span>"; break;
                                     case 3: return "<span class='label label-info'>分享</span>"; break;
                                 }
                             }
                         }, {
                             field: 'user_name',
                             title: '购买人',
                             align: 'center'
                         }, {
                             field: 'ParentOrderCode',
                             title: '订单',
                            align: 'center'
                        },{
                            field: 'folder_name',
                            title: '商家名称',
                            align: 'center',
                            formatter: function (value, row, index) {
                                if (!value)
                                    return "-";
                                return value;
                            }
                        }, {
                            field: 'file_name',
                             title: '商品名称',
                            align: 'center'
                        }, {
                            field: 'file_code',
                            title: '商品代码',
                            align: 'center'
                        }, {
                            field: 'TotalMoney',
                             title: '实付金额',
                             align: 'center'
                         },{
                             field: 'create_date',
                             title: '创建时间',
                             align: 'center'
                         }]
                }
                $table = tableHelper.initTable("exampleTableToolbar", options);
            },
            bindEvent: function () {
                $('#btnSearch').on('click', function () {
                    $table.bootstrapTable('refresh', options);
                });
            }
        }
        $(function () {
            goldManager.initPage();
        });
    </script>
}
